#pragma once
//============================================================================
// Copyright (C) 2009-2013 Brett R. Jones 
// All Rights Reserved
//
// You may redistribute and/or modify for non commercial and commercial uses 
// provided this copyright notice remains in place and is not modified
//
// This code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================

#include <VxUtilLib/VxSemaphore.h>

class RcSysTxEvent
{
public:
	//=== vars ===//
	RcSktBase *				m_poSkt;
	RcSysPktHdr *			m_poPkt;
	ESktCallbackReason		m_eCallbackReason;
	BOOL					m_bDisconnectAfterSend;

	//=== constructor ===//
	RcSysTxEvent();
	//=== constructor ===//
	RcSysTxEvent( RcSktBase * poSkt, VxPktHdr * poPkt, ESktCallbackReason eCallbackReason, BOOL bDisconnectAfterSend = false );

	//=== destructor ===//
	virtual ~RcSysTxEvent();

	//=== methods ===//

};

class RcSysSktTxEventQue 
{
public:
	//=== constructor ===//
	RcSysSktTxEventQue();
	//=== destructor ===//
	virtual ~RcSysSktTxEventQue();

	//=== methods ===//
	//! add event to que
	void			AddSktTxEvent( RcSysTxEvent * poEvent );
	//! remove event from que.. returns null if no events avalil
	RcSysTxEvent *	RemoveSktTxEvent(  void );

	//=== vars ===//
	VxMutex						m_oTxEventMutex;
	std::vector<RcSysTxEvent*>	m_aoTxEvents;
	VxSemaphore					m_oTxSemaphore;


};



